<%@ page import="cdu.javaendwork.model.utilModel.Adoption_display_info" %>
<%@ page import="java.util.List" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>查看领养请求</title>
    <meta charset="UTF-8">
    <link rel="stylesheet" href="/static/bootstrap-5.1.3-dist/css/bootstrap.css">
    <script type="text/javascript" src="/static/bootstrap-5.1.3-dist/js/bootstrap.js"></script>
</head>

<style>
    .back{
        position: absolute;
        font-size: 26px;
        top:30px;
        left:40px;
        text-decoration: none;
        color: #000;
        font-weight: bold;
    }
    .back:hover{
        color: #000;
    }


    .card{
        width: 1400px;
        height: 700px;
        background-color: #fffdfd;
        border-radius: 30px;
        border: none;
        box-shadow: 5px 5px 10px #adabab;
        position: absolute;
        top: 0;
        bottom: 0;
        left: 0;
        right: 0;
        margin: auto;

    }

    .content{
        display: flex;
        justify-content: center;
        margin-top: 30px;

    }
    .content-item{
        width: 640px;
        height: 640px;
        /*background-color: pink;*/
        margin: 0 20px;
        border-radius: 15px;
        border: 1px solid #2c3034;
        box-shadow: 3px 3px 5px #adabab;
        padding: 0 10px;
    }
    .content-item h2{
        text-align: center;
        margin: 10px 0;
    }
    table {
        text-align: center;
        vertical-align: middle !important;
        word-wrap:break-all;
        word-break:break-all;
        table-layout:fixed;

        /*!*width: 90% !important;*!*/
        /*margin-left: 80px;*/
        /*margin-top: 30px;*/
        padding: 0 10px !important;

    }
    .page {
        height: 50px;
        /*width: 1270px;*/
        /*margin-left: 1400px;*/
        position: fixed;
        bottom: 180px;
        right: 200px;
    }

</style>

<body>
<a href="${pageContext.request.contextPath}/post_list" class="back">
    <span><</span>返回</a>

<div class="card">
<div class="content">
    <div class="content-item">
        <h2>我的领养请求</h2>
        <table class="table table-bordered table-striped">
            <tr>
                <th>序号</th>
                <th>发出领养人</th>
                <th>领养帖主题</th>
                <th>领养状态</th>
                <th>请求时间</th>
            </tr>
            <c:forEach items="${requestsList}" var="req" varStatus="r">
                <c:forEach items="${postList}" var="post" varStatus="p">
                    <c:if test="${req.postid == post.id}">
                        <tr>
                            <td>${r.count}</td>
                            <td>${username}</td>
                            <td>${post.title}</td>
                            <td>
                                <c:if test="${req.status == 1}">
                                    暂未处理
                                </c:if>
                                <c:if test="${req.status == 2}">
                                    已被接受
                                </c:if>
                                <c:if test="${req.status == 3}">
                                    已被拒绝
                                </c:if>
                                <c:if test="${req.status == 4}">
                                    宠物已被他人领养
                                </c:if>
                            </td>
                            <td>${req.date}</td>
                        </tr>
                    </c:if>
                </c:forEach>
            </c:forEach>

        </table>
    </div>
    <div class="content-item">
        <h2>处理我的帖子</h2>
        <table class="table table-bordered table-striped">
            <tr>
                <th>序号</th>
                <th>宠物姓名</th>
                <th>请求人姓名</th>
                <th>请求人电话</th>
                <th>请求时间</th>
                <th>是否同意</th>
            </tr>

            <c:forEach items="${info}" var="info" varStatus="p">
            <tr>
                <td>${p.count}</td>
                <td>${info.petName}</td>
                <td>${info.userName}</td>
                <td>${info.userIphoto}</td>
                <td>${info.date}</td>
                <td>
                    <c:if test="${info.userName != null}">
                        <form action="${pageContext.request.contextPath}/handle_adoption_request" method="get">
                            <label class="radio-inline">
                                <input type="radio" id="inlineRadio2" name="inlineRadioOptions" value="2"> accept
                            </label>
                            <label class="radio-inline">
                                <input type="radio" id="inlineRadio1" name="inlineRadioOptions" value="1"> refuse
                            </label>
                            <input type="hidden" name="postid" value="${info.postid}">
                            <input type="hidden" name="requestid" value="${info.requestid}">
                            <input type="submit" value="保存">
                        </form>
                    </c:if>
                </td>
                </c:forEach>

            </tr>
        </table>
    </div>


</div>
</div>



<%--<jsp:include page="static/Page/common/Foot.jsp"/>--%>

</body>
</html>
